<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>graph_power</title>
  </head>
  <body bgcolor="#FFFFFF">
    <center>Scilab function</center>
    <div align="right">Last update : September 1996</div>
    <p>
      <b>graph_power</b> -  kth power of a directed 1-graph</p>
    <h3>
      <font color="blue">Calling Sequence</font>
    </h3>
    <dl>
      <dd>
        <tt>g1 = graph_power(g,k)  </tt>
      </dd>
    </dl>
    <h3>
      <font color="blue">Parameters</font>
    </h3>
    <ul>
      <li>
        <tt>
          <b>g</b>
        </tt>: graph list of the graph</li>
      <li>
        <tt>
          <b>k</b>
        </tt>: integer</li>
      <li>
        <tt>
          <b>g1</b>
        </tt>: graph list of the new graph</li>
    </ul>
    <h3>
      <font color="blue">Description</font>
    </h3>
    <p>
      <tt>
        <b>graph_power</b>
      </tt> computes the directed graph <tt>
        <b>g1</b>
      </tt> which is the kth power 
    of directed 1-graph <tt>
        <b>g</b>
      </tt>.
    There is an arc between two nodes in <tt>
        <b>g1</b>
      </tt> if there exists a path between 
    these nodes of length at most k in <tt>
        <b>g</b>
      </tt>.
    <tt>
        <b>graph_power(g,1)</b>
      </tt> is graph <tt>
        <b>g</b>
      </tt>.</p>
    <p>
    If such a graph does not exist, an empty vector is returned.</p>
    <h3>
      <font color="blue">Examples</font>
    </h3>
    <pre>

ta=[1 1 2 4 4 5 6 7 2 3 5 1];
he=[2 6 3 6 7 8 8 8 4 7 3 5];
g=make_graph('foo',1,8,ta,he);
g('node_x')=[285  284  335  160  405  189  118  45];
g('node_y')=[266  179   83  176  368  252  64  309];
show_graph(g);
g1=graph_power(g,2);
show_graph(g1,'new');
 
  </pre>
  </body>
</html>
